package com.xzkydz.all_sensor.fragment;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

import com.xzkydz.all_sensor.activity.MainActivity;
import com.xzkydz.all_sensor.allsensor.R;

/**
 * Created by Smilekun on 2016/8/26.
 */
public class WenDu_Fragment extends Fragment{
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View  view  =  inflater.inflate(R.layout.fragment_wendu, container, false);
        final MainActivity mActivity  = (MainActivity)getActivity();
        Button  button1 = (Button)view.findViewById(R.id.btn_20);
        Button  button2  = (Button)view.findViewById(R.id.btn_40);

        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mActivity.sendPortData("4B5909010500010200141A");
                Toast.makeText(mActivity,"校准成功...",Toast.LENGTH_SHORT).show();
            }
        });

        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mActivity.sendPortData("4B59090105000102002826");
                Toast.makeText(mActivity,"校准成功...",Toast.LENGTH_SHORT).show();

            }
        });

        return  view;
    }
}
